{% extends 'test_orm/base.html' %}
{% block page_content %}
<!--Bootstrap的面板控件-->
<div class="panel panel-primary">
    <div class="panel-heading">
        <!--这里加标题-->
        <h3 class="panel-title">员工列表</h3>
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-3 pull-right" style="margin-bottom: 15px">
                <div><a href="/test_orm/add_employee/" class="btn btn-primary pull-right"><i class="fa fa-user-plus fa-fw" aria-hidden="true"></i>&nbsp;增加记录</a></div>
            </div>
        </div>
    </div>
    <table class="table table-bordered table-condensed table-striped table-hover">
        <thead>
        <tr>
            <td>姓名</td>
                    <td>邮箱</td>
                    <td>薪水</td>
                    <td>地址</td>
                    <td>部门</td>
                    <td>团队</td>
                    <td colspan="2">操作</td>
        </tr>
        </thead>
        <tbody>
            <!--    dep_list即为类视图list_dep_old()中render传入的参数        -->
            {% for emp in emp_list %}
            <tr>
                <td>{{emp.name}}</td>
                <td>{{emp.email}}</td>
                <td>{{emp.salary}}</td>
                <td>{{emp.info.address}}</td>
                <td>{{emp.dep.dep_name}}</td>
                <td>
                    {% for gp in emp.group.all %}
                    {% if forloop.last %}
                    {{gp.group_name}}
                    {% else %}
                    {{gp.group_name}},
                    {% endif %}
                    {% endfor %}
                </td>
                <td><a href="/test_orm_old/del_employee/{{emp.id}}/" class="btn btn-danger"><i class="fa fa-trash-o fa-fw" aria-hidden="true"></i>&nbsp;删除</a></td>
                <td><a href="/test_orm_old/edit_employeed/{{emp.id}}/" class="btn btn-info"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>&nbsp;修改</a></td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="7">无相关记录</td>
            </tr>
            {% endfor %}
            </tbody>
    </table>
</div>
{% endblock %}
{% block employeecls %}
    active
{% endblock %}